<script type="text/javascript">
	$(document).ready(function(){

		$.formValidator.initConfig({
			formid:"userForm1",
			onerror:function(msg){
			},
			onsuccess:function(){
				if ($('#homepage_banner').val() == ''){
					$("#alert_box").jk_alert({msg: "请上传认证页面主图", type: 'danger', show_time: 8000});
                	return false;
				}
			}
		}); 
		$("#shop_name").formValidator({empty:false, onshow:"请输入店铺名称", onfocus:"店铺名称将显示在认证页面及微站，长度（2-20个字）", oncorrect:" "})
		.functionValidator({fun:function(val,elem){
			if (val.length >= 2 && val.length <= 40){
				return true;
			}else{
				return 	'输入错误';
			}
		}});
		$("#telephone").formValidator({empty:false,onshow:"请输入店铺联系电话",onfocus:"店铺联系电话显示在微站，长度（2-40个数字）",oncorrect:" "})
		.functionValidator({fun:function(val,elem){
			if (val.length >= 2 && val.length <= 40){
				return true;
			}else{
				return 	'输入错误';
			}
		}});
		
		


		var imagename = "{$info['homepage_logo']}";
		var fullbackuptab = $('#config_upload_processhomepage_logo').html5uploader({
			fileTypeExts:'image/jpeg,image/png,image/jpg', //支持上传的后缀名，多个用逗号隔开, 填写mime类型
			auto:true,  //是否自动上传
			removeTimeout:3000,  //上传成功后，进度条多少毫秒后消失
			url:"{:U('Merchant/upload_img')}",
			input_file_id:'input-file-config',  //上传控件的id
			formData:{'type':'merchantlogo', 'imagename':imagename},  //附加的参数,POST方式提交
			onCheckFileTypeExts:function(){   //文件类型不对的回调函数
				$("#alert_box_merchantlogo").jk_alert({msg:'文件类型错误!', type:'danger', show_time:8000});
			},
			onSelect: function(file){
				
			},
			onUploadStart:function(){  //开始上传的回调函数
				
			},
			onInit:function(){  //初始化的回调函数
				//美化上传框
				$('#input-file-config').ace_file_input({no_file:'点击选择文件 ...', btn_choose:'上传', btn_change:'修改', droppable:false});
			},
			onUploadComplete:function(){   //上传完成的回调函数
				//$("#alert_box_config").jk_alert({msg:'上传完成，正在升级，请稍候...', type:'success', show_time:8000});
			
			},
			onUploadSuccess:function(file, responseText){  //上传成功的回调函数
				var data = JSON.parse(responseText);
				if ( 1 == data.ret) { 
					$('#demo_homepage_logo').attr('src', '__PUBLIC__/'+data.data.savepath+data.data.savename).show();
					$('#homepage_logo').val(data.data.savename);
					fullbackuptab.formData = {'type':'merchantlogo', 'imagename':data.data.savename};
				}else{
					$("#alert_box_merchantlogo").jk_alert({msg: data.msg, type:'danger', show_time:12000});
				}
			
			},
			onUploadError:function(file, responseText){
				$("#alert_box_merchantlogo").jk_alert({msg:responseText.msg, type:'danger', show_time:8000});
			}
		});
		var imagename1 = "{$info['homepage_banner']}";
		var fullbackuptab1 = $('#config_upload_processhomepage_banner').html5uploader({
			fileTypeExts:'image/jpeg,image/png,image/jpg', //支持上传的后缀名，多个用逗号隔开, 填写mime类型
			auto:true,  //是否自动上传
			removeTimeout:3000,  //上传成功后，进度条多少毫秒后消失
			url:"{:U('Merchant/upload_img')}",
			input_file_id:'input-file-config1',  //上传控件的id
			formData:{'type':'merchantbanner', 'imagename':imagename1},  //附加的参数,POST方式提交
			onCheckFileTypeExts:function(){   //文件类型不对的回调函数
				$("#alert_box_homepage_banner").jk_alert({msg:'文件类型错误!', type:'danger', show_time:8000});
			},
			onSelect: function(file){
				
			},
			onUploadStart:function(){  //开始上传的回调函数
				
			},
			onInit:function(){  //初始化的回调函数
				//美化上传框
				$('#input-file-config1').ace_file_input({no_file:'点击选择文件 ...', btn_choose:'上传', btn_change:'修改', droppable:false});
			},
			onUploadComplete:function(){   //上传完成的回调函数
				//$("#alert_box_config").jk_alert({msg:'上传完成，正在升级，请稍候...', type:'success', show_time:8000});
			
			},
			onUploadSuccess:function(file, responseText){  //上传成功的回调函数
				var data = JSON.parse(responseText);
				if ( 1 == data.ret) { 
					$('#demo_homepage_banner').attr('src', '__PUBLIC__/'+data.data.savepath+data.data.savename).show();
					$('#homepage_banner').val(data.data.savename);
					fullbackuptab1.formData = {'type':'merchantbanner', 'imagename':data.data.savename};
				}else{
					$("#alert_box_homepage_banner").jk_alert({msg: data.msg, type:'danger', show_time:12000});
				}
			
			},
			onUploadError:function(file, responseText){
				$("#alert_box_homepage_banner").jk_alert({msg:responseText.msg, type:'danger', show_time:8000});
			}
		});
		
	});
</script>


<div class="page-content">
	<div class="row">
		<div class="col-xs-12"> 
			<div class="tabbable">
				<nav class="navbar navbar-default abc" role="navigation">
					<div class="container-fluid">
						<!-- Brand and toggle get grouped for better mobile display -->
						<div class="navbar-header">
							<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
							<span class="sr-only"></span>
							<span class="icon-bar"></span>
							<span class="icon-bar"></span>
							<span class="icon-bar"></span>
							</button>
						</div>

						<!-- Collect the nav links, forms, and other content for toggling -->
						<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
							<ul class="nav navbar-nav">
								<li >
									<a href="{:U('Merchant/auth_set')}">
										<i class="blue icon-cloud bigger-110"></i>
										认证设置
									</a>
								</li>
								<li class="active">
									<a href="#">
										<i class="green icon-cog bigger-110"></i>
										页面设置
									</a>
								</li>
								<li>
									<a  href="{:U('Merchant/ad_set')}">
										<i class="red icon-list bigger-110"></i>
										广告设置
									</a>
								</li>
								

							</ul>
						</div><!-- /.navbar-collapse -->
					</div><!-- /.container-fluid -->
				</nav>
				<div class="tab-content">
					<div class="tab-pane active">
						<div id="status-pane" class="form-horizontal">
							<form name="userForm1" id="userForm1" novalidate="" action="{:U('Merchant/save_page')}" method="post"> 
								<div class="form-horizontal">
									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right margintop5" > 
											店名： 
										</label>
										<div class="col-sm-4">
											<div class="input-group col-xs-10 col-sm-12 ">
												<input type="text" id="shop_name" name="shop_name"  class="form-control" value="{$info.shop_name}"/>
											</div>
											
										</div>
										<div class="help-block col-sm-6" >
											<span id="shop_nameTip"></span>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right margintop5"> 
											店铺联系电话： 
										</label>
										<div class="col-sm-4">
											<div class="input-group col-xs-12">
												<input type="text" id="telephone" name="telephone" class="form-control" value="{$info.telephone}"/>
											</div>
										</div>
										<div class="help-block col-sm-6" >
											<span id="telephoneTip"></span>
										</div>
									</div>

									
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right margintop5" for="form-field-1"> 
											店铺图标： 
										</label>
										<div class="col-sm-9">
											<div class="input-group col-xs-10 col-sm-6 ">
												<div id="config_upload_processhomepage_logo"></div>
												<input type="hidden" name="homepage_logo" id="homepage_logo" value="{$info.homepage_logo}"> 
												<img id="demo_homepage_logo" src="__PUBLIC__/upload/merchantlogo/{$info['homepage_logo']}" class="img-thumbnail col-xs-12 col-sm-4" style="<if condition="($info['homepage_logo'] eq '')">display:none;</if>" >
												<div class="space-4"></div>
												<div id="alert_box_merchantlogo"></div>
												<div style="clear:both;"></div>
												<p class="help-block dp">png/jpg/jpeg图片，小于2MB，分辨率建议宽度386px，高度200px</p>
											</div>

										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label no-padding-right margintop5" for="form-field-1"> 
											认证页面主图： 
										</label>
										<div class="col-sm-9">
											<div class="input-group col-xs-10 col-sm-6 ">
												<div id="config_upload_processhomepage_banner"></div>
												<input type="hidden" name="homepage_banner" id="homepage_banner" value="{$info.homepage_banner}"> 
												<img id="demo_homepage_banner" src="__PUBLIC__/upload/merchantbanner/{$info['homepage_banner']}" class="img-thumbnail col-xs-12 col-sm-4" style="<if condition="($info['homepage_banner'] eq '')">display:none;</if>" >
												<div class="space-4"></div>
												<div id="alert_box_homepage_banner"></div>
												<div style="clear:both;"></div>
												<p class="help-block dp">png/jpg/jpeg图片，小于2MB，分辨率建议宽度640px，高度960px</p>
											</div>

										</div>
									</div>
									
									
									
									<div id="alert_box"></div>
									<div class="clearfix form-actions">
										<div class="col-md-offset-3 col-md-9 col-sm-9">
											<button id="save" class="col-sm-2 btn btn-success" data-loading-text="正在提交,请稍候..." type="submit">
												<i class="icon-save bigger-110"></i>
											 	<span id="submitbutton">保存</span>
											</button>
											<button class="col-sm-2 btn btn-default left10" type="reset">
												<i class="icon-reply bigger-110"></i>
											 	<span id="submitbutton">取消</span>
											</button>
										</div>
									</div>
								</div>
							</form>
							<div id="table-list" class="widget-box transparent" ng-if="info1 && info1.length>0">
								<div class="widget-header widget-header-flat widget-header-small"><h5><i class="icon-bell bigger-110 purple"></i>帮助</h5>
								</div>
								<div class="widget-body">
									<div class="widget-main">
										<ul class="tips_msg">
											<li>
												店铺名、店铺图标及认证页面图片会显示在认证页面。
											</li>
											<li>
												联系电话会用于微站
											</li>
										</ul>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>	
		</div>
	</div>
</div>